package com.lucun.insurance.controller;

import com.lucun.insurance.db.entity.Insure;
import com.lucun.insurance.service.InsureService;
import com.lucun.insurance.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: 郭鑫
 * @catalogue: com.lucun.insurance.db.controller
 * @Date: 2021/9/8 11:29
 * @Version: 1.0
 */
@RestController
@RequestMapping("/insure")
public class InsureController {
    @Autowired
    InsureService insureService;

    //    添加被保人信息
    @RequestMapping("/insert")
    public JsonResult<?> insert(@RequestBody Insure insure) {
        return insureService.insert(insure);
    }

    //    查询所有
    @RequestMapping("/findAll")
    public List<Insure> findAll() {
        return insureService.findAll();
    }

    //   根据投保人id查询
    @RequestMapping("/findById")
    public List<Insure> findById(@RequestBody Insure userId) {
        return insureService.findById(userId);
    }

    //    删除
    @RequestMapping("/delete")
    public JsonResult<?> delete(@RequestBody Insure insure) {
        return insureService.delete(insure);
    }

    //修改
    @RequestMapping("/update")
    public JsonResult<?> update(@RequestBody Insure insure) {
        return insureService.update(insure);
    }

}